package com.lintesis.lintesisview.webgui.protocolo.laboratorioexterno;

import org.zkoss.zkplus.databind.BindingListModel;
import org.zkoss.zkplus.databind.BindingListModelList;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Textbox;

import com.lintesis.lintesismodel.common.Type;
import com.lintesis.lintesismodel.common.hibernate.GenericDAO;
import com.lintesis.lintesismodel.protocolo.LaboratorioExterno;
import com.lintesis.lintesisview.common.ABMDialogCtrl;
import com.lintesis.lintesisview.common.menu.UserWorkspace;

public class LaboratorioExternoDialogCtrl extends ABMDialogCtrl<LaboratorioExterno>{

	private static final long serialVersionUID = 7012016021630192221L;

	static final String rightPreffix = "laboratorioExterno.dialog.";
	
	Textbox tbRazonSocial;
	Combobox cbEspecialidad;
	Textbox tbDomicilio;
	Textbox tbEmail;
	Textbox tbTelefono;
	Textbox tbNombreContacto;
	
	BindingListModel lmEspecialidades; 
	
	@Override
	protected void doSetClearComponents() {
		clearComponents.add(tbRazonSocial);
		clearComponents.add(cbEspecialidad);
		clearComponents.add(tbDomicilio);
		clearComponents.add(tbEmail);
		clearComponents.add(tbTelefono);
		clearComponents.add(tbNombreContacto);		
	}

	@Override
	protected void doSetFieldProperties() {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void doSetReadOnlyComponents() throws Exception {
		roComponents.addAll(clearComponents);
		
	}

	@Override
	protected void doSetValidation() throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void fillBussinesObject() throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void fillComboBoxs() throws Exception {
		try
		{
			lmEspecialidades = new BindingListModelList(new GenericDAO<Type>(UserWorkspace.getInstance().gethSession()).getByBussinessObject(new Type()), true);
		} catch (Exception e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

	@Override
	public String getEntityName() {
		
		return "LaboratorioExterno";
	}

	@Override
	protected LaboratorioExterno getNewEntidad() {
		LaboratorioExterno laboratorioExterno = new LaboratorioExterno();
		return laboratorioExterno;
	}

	@Override
	protected String getRightPreffix() {
		return rightPreffix;
	}

}
